<? 
		if(isset($_POST['btnsubmit']))
		{
			require("required/dbconnect.php"); 
			
			$title=mysql_escape_string($_POST['title']);
			$row=$_POST['row_no'];
			$order_id=$_POST['order_id'];
			$id=$_POST['hidid'];
			
			$insert=mysql_query("update os_custserv_cat set cat_name='$title',row='$row',order_id=$order_id where id=$id")or die(mysql_error());
			header("Location:custservcat_edit.php?id=$id&msg=1");
		
		}
		else
		{
				 
				if(empty($_GET['id']))
				{
					require("required/dbconnect.php");
					header("Location:os_invalid.php");
				}
				
				require("required/dbconnect.php"); 
				require("required/function.php");
				require("required/header.php"); 
				$id=$_GET['id'];
				$get=mysql_query("select * from os_custserv_cat where id=$id");
				
				$a=mysql_fetch_array($get,MYSQL_ASSOC);
				
				
				
				
				
?>
				
				<table width="100%"  cellpadding="0" cellspacing="5" height="300">
				<script language="JavaScript">
					function validatefrm(frm1){
						if(document.frm1.title.value=="")
						{
							alert("Please enter title");
							document.frm1.title.focus();
							return false;
						}
						return true;
					}
				</script>		
				
					<td class="solidborder" width="84%" align="left" valign="top">
					<?
						if(!empty($_GET['msg'])){
					?>
					<img src="images/icons/tick.jpg" align="absmiddle"> Record updated!
					<?
						}
					?>
						<form action="<?= $_SERVER['PHP_SELF'] ?>" name="frm1" method="post" onSubmit="return validatefrm(this)">
						<table width="100%">
						
						<td class="title" colspan="3">
						<strong>Edit Record</strong>
						
						
						
						</td>
						
						<input type="hidden" value="<?= $id ?>" name="hidid">
						<tr valign="top">
							<td colspan="4"><hr>
							
							</td>
						</tr>
						
						
						<tr>
							<td>Title</td><td>:</td><td><input class="text" type="text" name="title" size="30" value="<?= $a['cat_name'] ?>" maxlength="200"></td>
						</tr>
						<tr>
							<td>Order ID</td><td>:</td><td><input class="text" type="text" name="order_id" size="2" value="<?= $a['order_id'] ?>" maxlength="2"></td>
						</tr>
						<tr>
							<td>Row</td><td>:</td><td><input class="text" type="text" name="row_no" size="2" value="<?= $a['row'] ?>" maxlength="2"></td>
						</tr>
						
							
						
						<tr>
							<td colspan="2"><input type="submit" value="Submit" name="btnsubmit"> <input type="button" value="Back" onClick="window.open('custserv.php','_self')"></td>
						</tr>
						</table>
						</form>
					</td>
				 
				</table>
<? }require("required/footer.php"); ?>